<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<fmt:setBundle basename="infomessages" var="info"/>

<%
	request.setAttribute("path", request.getContextPath());
%>
<script type="text/javascript">
function jump(id,stepViewId){
	if(confirm("确定回撤单据!")){
		 var uri = "${root}/${myuri}/jump/"+id+"/"+stepViewId;
		 $.post(uri,
			function( data ){
				if(data){
					alert("回退成功");
					$.unblockUI();
					window.parent.location.reload();
				}
		}); 
	}
}
function resubmit(id){
	
	if(confirm("确定再流转公文!")){
		var url = "${root}/${myuri}/resubmit/"+id;
		$.post(url, function(result){
			if(result){
				alert("再流转成功");
				$.unblockUI();
				window.parent.location.reload();
			}
		});
	}
	
}
</script>
<table  class="table table-bordered responsive">
	       <thead>
	           <tr>
	           	   <th style="width: 50px;" class="tc">序号</th>
	           	   <th style="width: 100px;" class="tc">任务描述</th>
	           	   <th style="width: 100px;" class="tc">状态</th>
	           	   <th style="width: 100px;" class="tc">操作人</th>
	               <th style="width: 200px;" class="tc">开始时间</th>
	               <th style="width: 200px;" class="tc">结束时间</th>
	               <th style="width: 50px;">撤回</th>
	           </tr>
	       </thead>
	       <tbody>
	       		<c:forEach var="vo" varStatus="vs" items="${wfDetail}">
					<tr>
						<td class="tc">
							${vs.count }
						</td>
						<td class="tc ellipsis" title="${vo.viewStepName}">
							 	<c:out value="${vo.viewStepName }" />
						</td>
						<td class="tc">
							<fmt:message key='wf.status.${vo.status}' bundle='${info}'></fmt:message>
						</td>
						<td class="tc">
							<c:out value="${vo.operator }" />
						</td>
						<td class="tc">
							<fmt:formatDate value="${vo.startDate}" pattern="yyyy-MM-dd hh:mm:ss" />
						</td>
						<td class="tc">
							<fmt:formatDate value="${vo.endDate}" pattern="yyyy-MM-dd hh:mm:ss" />
						</td>
						<td class="tc">
						 	<c:if test="${jump}">
							<c:if test='${vo.status == "Approve" || vo.status == "Reject"}'>
								<a class="blue-a" href='javascript:void(0)' onclick="jump('${docId }','${vo.id}')" >撤回</a>
							</c:if>
							<c:if test='${vo.status == "Submit"}'>
								 <a class="blue-a" href='javascript:void(0)' onclick="resubmit('${docId}')">撤回</a>
							</c:if>
							</c:if>
						</td>
						
					</tr>
				</c:forEach>
				<tr>
					<td colspan="7" class="tc"><input type="button"  value="关闭" onclick="$.unblockUI();" class="btn" /></td>
					
				</tr>
	       </tbody>
	       
	</table>

